package org.pearl.validation.demo.pojo;

import lombok.Data;
import lombok.ToString;

import javax.validation.constraints.NotEmpty;
import java.util.Date;

/**
 * Created by TD on 2021/5/14
 */
@ToString
@Data
public class User {

    @NotEmpty.List(value = {@NotEmpty(message = "1"), @NotEmpty(message = "2")})
    //@Pattern(message = "用户名只能是数字字母", regexp = "^[A-Za-z0-9-]*")
            String userName;
    //  @NotNull(message = "密码不能为null")
    // @Length(min = 10, max = 20, message = "密码长度必须在10-20之间")
    String password;

    // @Min(value = 1, message = "年龄不能小于1")
    // @Max(value = 150, message = "年龄不能大于100")
    // @Range(min = 1,max = 200,message = "年龄必须在1-200之间")
    int age;
    // @AssertTrue(message = "注册状态必须为true")
    boolean isRegistered;

    // @Past(message = "生日不能小于当前时间")
    Date birthday;

    // @DecimalMax(message = "金额不能大于99.99", value = "99.99")
    // @DecimalMin(message = "金额不能小于0.99", value = "0.99")
    // @Digits(integer = 3, fraction = 2,message = "金额的整数不能超过3位，小数部分不能超过2位")
    Double money;

    // @URL
    String url;


    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public boolean isRegistered() {
        return isRegistered;
    }

    public void setRegistered(boolean registered) {
        isRegistered = registered;
    }
}
